﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PH.Model
{
    public class Help
    {
        public static string GetGradeName(int code)
        {
            switch (code)
            {
                case 11:
                    return "一年级";
                case 12:
                    return "二年级";
                case 13:
                    return "三年级";
                case 14:
                    return "四年级";
                case 15:
                    return "五年级";
                case 16:
                    return "六年级";
                case 21:
                    return "七年级";
                case 22:
                    return "八年级";
                case 23:
                    return "九年级";
                case 31:
                    return "高一";
                case 32:
                    return "高二";
                case 33:
                    return "高三";
                case 41:
                    return "大一";
                case 42:
                    return "大二";
                case 43:
                    return "大三";
                case 44:
                    return "大四";
                case 45:
                    return "大五";
                default: 
                    return "";
            }
        }
        public static string GetGradeLevel(int code)
        {
            if (code < 20)
                return "小学";
            else if (code > 20 && code < 30)
                return "初中";
            else if (code > 30 && code < 40)
                return "高中";
            else
                return "大学";
        }
        public static string GetGradeLevelString(int l)
        {
            switch (l)
            {
                case 1:
                    return "小学";
                case 2:
                    return "初中";
                case 3:
                    return "高中";
                case 4:
                    return "大学";
                default:
                    return "";
            }
        }

        public static string GetScoreLevel(int l)
        {
            switch (l)
            {
                case 1:
                    return "不及格";
                case 2:
                    return "及格";
                case 3:
                    return "良好";
                case 4:
                    return "优秀";
                default:
                    return "";
            }
        }

        public static byte GetLevelScore(int score)
        {
            if (score < 60)
                return 1;
            else if (score >= 60 && score < 80)
                return 2;
            else if (score >= 80 && score < 90)
                return 3;
            else
                return 4;
        }

        public static string GetSex(byte s)
        {
            switch (s)
            {
                case 1:
                    return "男";
                case 2:
                    return "女";
                default:
                    return "";
            }
        }
        /// <summary>
        /// 将十进制的时间转成可阅读的耐力跑的时间
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public static string GetRunTime(int d)
        {
            return string.Format("{0}'{1}", d / 60, d % 60);
        }
        public static string GetRunTime(string s)
        {
            var d = int.Parse(s);
            return GetRunTime(d);
        }
    }
}
